package com.ydt.service.serviceImpl;

import com.ydt.dao.YdtShoppingcartDao;
import com.ydt.entity.YdtShoppingcart;
import com.ydt.service.YdtShoppingcartService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (YdtShoppingcart)表服务实现类
 *
 * @author makejava
 * @since 2020-12-29 09:44:32
 */
@Service("ydtShoppingcartService")
public class YdtShoppingcartServiceImpl implements YdtShoppingcartService {

    @Resource
    private YdtShoppingcartDao ydtShoppingcartDao;

    /**
     * 通过ID查询单条数据
     *

     * @return 实例对象
     */
    @Override
    public List<YdtShoppingcart> queryById(YdtShoppingcart ydtShoppingcart) {
        return this.ydtShoppingcartDao.queryById(ydtShoppingcart);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<YdtShoppingcart> queryAllByLimit(int offset, int limit) {
        return this.ydtShoppingcartDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param ydtShoppingcart 实例对象
     * @return 实例对象
     */
    @Override
    public YdtShoppingcart insert(YdtShoppingcart ydtShoppingcart) {
        this.ydtShoppingcartDao.insert(ydtShoppingcart);
        return ydtShoppingcart;
    }

    @Override
    public List<YdtShoppingcart> sel() {
        return ydtShoppingcartDao.sel();
    }


    /**
     * 修改数据
     *
     * @param ydtShoppingcart 实例对象
     * @return 实例对象
     */


    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.ydtShoppingcartDao.deleteById(id) > 0;
    }

    @Override
    public int update(YdtShoppingcart ydtShoppingcart) {
        return ydtShoppingcartDao.update(ydtShoppingcart);
    }

    @Override
    public int insertOrUpdateBatch(List<YdtShoppingcart> entities) {
        return ydtShoppingcartDao.insertOrUpdateBatch(entities);
    }

    @Override
    public int update0(YdtShoppingcart ydtShoppingcart) {
        return ydtShoppingcartDao.update0(ydtShoppingcart);
    }
    @Override
    public int update1(YdtShoppingcart ydtShoppingcart) {
        return ydtShoppingcartDao.update1(ydtShoppingcart);
    }

    @Override
    public int delete(YdtShoppingcart ydtShoppingcart) {
        return ydtShoppingcartDao.delete(ydtShoppingcart);
    }

}